var validateDate = (rule, value, callback)=>{
	var date1 = new Date()
	var date2 = new Date(value)
	if(!value){
		callback(new Error('请选择预计完成时间'));
	}
	if (date2 < date1) {
	
	  callback(new Error('结束时间需大于或等于今天'));
	} else {
	  callback();
	}
};

export const tableOption = {
  "align": "center",
  "index": true,
  "border": true,
  "column": [{
    "prop": "id",
    "span": 24,
    "type": "input",
    "label": "id",
    "display": false,
    hide:true
  }, {
    "prop": "userId",
    "span": 24,
    "type": "input",
    "label": "创建人id",
    "display": false,
    hide:true
  }, {
    "prop": "userName",
    "span": 24,
    "type": "input",
    "label": "创建人姓名",
    "display": false,
    hide:true
  }, {
    "prop": "title",
    "span": 24,
    "type": "input",
    "label": "标题",
    "display": true,
    rules: [{
      required: true,
      message: '标题不能为空',
      trigger: 'blur'
    }]
  },{
    "prop": "level",
    "span": 24,
    "type": "select",
    "label": "紧急程度",
    "props": {
      "label": "label",
      "value": "value"
    },
    "dicData": [{
      "label": "正常",
      "value": '0'
    }, {
      "label": "紧急",
      "value": '1'
    }, {
      "label": "非常紧急",
      "value": '2'
    }],
    "display": true,
    slot: true,
    "cascaderItem": []
  }, {
    "prop": "description",
    "span": 24,
    "type": "textarea",
    "label": "任务描述",
    "display": true
  }, {
    "max": 100,
    "min": 0,
    "prop": "progress",
    "span": 24,
    "step": 1,
    "type": "slider",
    "label": "完成进度",
    addDisplay: false
  },{
    "prop": "createTime",
    "span": 24,
    "type": "date",
    "label": "创建时间",
    "format": "yyyy-MM-dd",
    "display": true,
    "valueFormat": "yyyy-MM-dd",
    readonly:true,
    display:false
  }, {
    "prop": "finishTime",
    "span": 24,
    "type": "date",
    "label": "预计完成时间",
    "format": "yyyy-MM-dd",
    "display": true,
    "valueFormat": "yyyy-MM-dd",
    rules: [{
      validator: validateDate, trigger: 'blur' 
    }]
  },{
    "prop": "isFinish",
    "span": 24,
    "type": "switch",
     slot: true,
     addDisplay: false,
    "label": "任务是否完成",
    "value": 0,
    "dicData": [{
      "label": "未完成",
      "value": 0
    }, {
      "label": "已完成",
      "value": 1
    }],
  }],
  "gutter": 0,
  "stripe": false,
  "menuBtn": true,
  "emptyBtn": true,
  "emptyText": "清空",
  "menuAlign": "center",
  "submitBtn": true,
  "indexLabel": "序号",
  "labelWidth": 120,
  "submitText": "提交",
  "labelSuffix": "：",
  "menuPosition": "center",
  "labelPosition": "left",
  "searchMenuSpan": 6
}



export const tableOption2 = {
  "align": "center",
  "index": true,
  "border": true,
  "column": [{
    "prop": "id",
    "span": 24,
    "type": "input",
    "label": "id",
    "display": false,
    hide:true
  }, {
    "prop": "userId",
    "span": 24,
    "type": "select",
    "label": "协作人",
    "props": {
      "label": "username",
      "value": "id"
    },
    dicUrl: "http://localhost:8080/message/task/getAllUser",
    dicMethod: 'get',
    rules: [{
      required: true,
      message: '请选择协作人',
      trigger: 'blur'
    }]
  }, {
    "prop": "userName",
    "span": 24,
    "type": "input",
    "label": "协作人姓名",
    "display": false,
    hide:true
  }, {
    "prop": "title",
    "span": 24,
    "type": "input",
    "label": "标题",
    "display": true,
    rules: [{
      required: true,
      message: '标题不能为空',
      trigger: 'blur'
    }]
  },{
    "prop": "level",
    "span": 24,
    "type": "select",
    "label": "紧急程度",
    slot:true,
    "props": {
      "label": "label",
      "value": "value"
    },
    "dicData": [{
      "label": "正常",
      "value": '0'
    }, {
      "label": "紧急",
      "value": '1'
    }, {
      "label": "非常紧急",
      "value": '2'
    }],
    "display": true,
    "cascaderItem": []
  }, {
    "prop": "description",
    "span": 24,
    "type": "textarea",
    "label": "任务描述",
    "display": true
  }, {
    "max": 100,
    "min": 0,
    "prop": "progress",
    "span": 24,
    "step": 1,
    "type": "slider",
    "label": "完成进度",
    addDisplay:false,
  },{
    "prop": "createTime",
    "span": 24,
    "type": "date",
    "label": "创建时间",
    "format": "yyyy-MM-dd",
    "display": true,
    "valueFormat": "yyyy-MM-dd",
    display:false

  }, {
    "prop": "finishTime",
    "span": 24,
    "type": "date",
    "label": "预计完成时间",
    "format": "yyyy-MM-dd",
    "display": true,
    "valueFormat": "yyyy-MM-dd",
    rules: [{
      validator: validateDate, trigger: 'blur' 
    }]
  },{
    "prop": "isFinish",
    "span": 24,
    "type": "switch",
     slot: true,
     addDisplay: false,
    "label": "任务是否完成",
    "value": 0,
    "dicData": [{
      "label": "未完成",
      "value": 0
    }, {
      "label": "已完成",
      "value": 1
    }],
  }],
  "gutter": 0,
  "stripe": true,
  "menuBtn": true,
  "emptyBtn": true,
  "emptyText": "清空",
  "menuAlign": "center",
  "submitBtn": true,
  "indexLabel": "序号",
  "labelWidth": 120,
  "submitText": "提交",
  "labelSuffix": "：",
  "menuPosition": "center",
  "labelPosition": "left",
  "searchMenuSpan": 6
}
